﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Gclbgl.aspx.cs" Inherits="Xiaov.SmartWeb.Application.TZGC.GCLB.Gclbgl" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>工程类别管理</title>
    <script type="text/javascript" src="../../SupCan/binary/dynaload.js?60"></script>
    <script type="text/javascript" language="javascript">
        var bAFReady = false;
        var bAF1Ready = false;
        function OnReady(id) {
            if (id == "AF") {
                var ddl_gczt = document.getElementById("ddl_gczt");
                var gczt = ddl_gczt.options[ddl_gczt.selectedIndex].value;
                var ddl_gclb = document.getElementById("ddl_gclb");
                var gclb = ddl_gclb.options[ddl_gclb.selectedIndex].value;
                document.AF.func("Build", "Gclbgl.xml");
                document.AF.func("Load", "GclbglData.aspx?gczt=" + escape(gczt) + "&gclb=" + gclb);
                bAFReady = true;
            }
            else if (id == "AF1") {
                var ddl_gclb = document.getElementById("ddl_gclb");
                var gclb = ddl_gclb.options[ddl_gclb.selectedIndex].value;
                document.AF1.func("Build", "Gclbgl.xml");
                document.AF1.func("Load", "GclbglData.aspx?gclb=" + escape(gclb));
                bAF1Ready = true;
            }
            if (bAFReady && bAF1Ready) enableDrag();
        }
        function enableDrag() {
            //AF <==> AF1
            var handle = document.AF.func("GetHandle", "");
            document.AF1.func("EnableDrag", handle);
            handle = document.AF1.func("GetHandle", "");
            document.AF1.func("EnableDrag", handle);
        }

        function queryData() {
            var ddl_gczt = document.getElementById("ddl_gczt");
            var gczt = ddl_gczt.options[ddl_gczt.selectedIndex].value;
            var gcmc = document.getElementById("t_gcmc").value;
            var ddl_gclb = document.getElementById("ddl_gclb");
            var gclb = ddl_gclb.options[ddl_gclb.selectedIndex].value;
            document.AF.func("Load", "GclbglData.aspx?gczt=" + escape(gczt) + "&gcmc=" + escape(gcmc) + "&gclb=" + gclb);

        }

        function getGclbData() {
            var ddl_gczt = document.getElementById("ddl_gczt");
            var gczt = ddl_gczt.options[ddl_gczt.selectedIndex].value;
            var gcmc = document.getElementById("t_gcmc").value;
            var ddl_gclb = document.getElementById("ddl_gclb");
            var gclb = ddl_gclb.options[ddl_gclb.selectedIndex].value;
            document.AF1.func("Load", "GclbglData.aspx?gclb=" + escape(gclb));
            document.AF.func("Load", "GclbglData.aspx?gczt=" + escape(gczt) + "&gcmc=" + escape(gcmc) + "&gclb=" + gclb);
        }

        function saveData() {
            var hdGcWgsData = document.AF.func("GetChangedXML", "level=2");
            var hdGcWgs = document.getElementById('<%=HDGcWgs.ClientID%>');
            hdGcWgs.value = hdGcWgsData;

            var hdGcYgsData = document.AF1.func("GetChangedXML", "level=2");
            var hdGcYgs = document.getElementById('<%=HDGcYgs.ClientID%>');
            hdGcYgs.value = hdGcYgsData;
            if (hdGcWgsData == "0" || hdGcYgsData == "0") {
                return false;
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align: right; width: auto;">
        <asp:HiddenField ID="HDGcWgs" runat="server"></asp:HiddenField>
        <asp:HiddenField ID="HDGcYgs" runat="server"></asp:HiddenField>
    </div>
    <table style="text-align: center; width: 100%; height: 100%">
        <tr style="height: 5%; width: 100%; font-size: 10pt">
            <td style="width: 20%; text-align: left">
                工程名称<input type="text" id="t_gcmc" />
            </td>
            <td style="width: 30%; text-align: left">
                工程状态<select id="ddl_gczt"><option value="all">全部</option>
                    <option value="0" selected="selected">未完成</option>
                    <option value="1">已完成</option>
                </select>
                <input type="button" id="btn_query" onclick="queryData();" value="查询" />
            </td>
            <td style="width: 2%">
            </td>
            <td style="width: 48%; text-align: left">
                工程类别:<select id="ddl_gclb" runat="server" onchange="getGclbData();">
                </select><asp:Button ID="btn_save" runat="server" Text="保存" 
                    OnClientClick="saveData();" onclick="btn_save_Click" />
            </td>
        </tr>
        <tr style="height: 95%; width: 100%">
            <td colspan="2">
                <script language="javascript" type="text/javascript">
                    insertTreeList("AF", "")          
                </script>
            </td>
            <td>
            </td>
            <td>
                <script language="javascript" type="text/javascript">
                    insertTreeList("AF1", "")          
                </script>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
